package com.atguigu.controller;

import com.atguigu.bean.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

/**
 * Date:2020/9/30
 * Author:ybc
 * Description:
 */
@Controller
public class JsonController {

    @RequestMapping("/testJSON")
    @ResponseBody
    public String testJSON(){
        return "success";
    }

    @RequestMapping("/testLogin")
    @ResponseBody
    public boolean testLogin(String username, String password){
        if("admin".equals(username) && "123456".equals(password)){
            return true;
        }else{
            return false;
        }
    }

    @RequestMapping("/showStudentInfo")
    @ResponseBody
    public List<Student> showStudentInfo(){
        List<Student> list = new ArrayList<>();
        list.add(new Student(1001,"张三1",23,"男","123@qq.com"));
        list.add(new Student(1002,"张三2",23,"男","123@qq.com"));
        list.add(new Student(1003,"张三3",23,"男","123@qq.com"));
        list.add(new Student(1004,"张三4",23,"男","123@qq.com"));
        list.add(new Student(1005,"张三5",23,"男","123@qq.com"));
        list.add(new Student(1006,"张三6",23,"男","123@qq.com"));
        return list;
    }

}
